package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.IntegrationCashCouponWallet;
import com.rockcent.mall.lib.dto.IntegrationCouponDetailRespDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by zhangjh on 2016/12/14.
 */
@Repository
public interface IntegrationCashCouponWalletRepository extends JpaRepository<IntegrationCashCouponWallet, Long>, JpaSpecificationExecutor, IntegrationCashCouponWalletRepositoryCustom {

    IntegrationCashCouponWallet findByExchangeCodeAndExchangeNumAndReceiveNumAndUseNum(String exchangeCode, long exchangeNuxm, long receiveNum, long useNum);

    IntegrationCashCouponWallet findByIdAndCustomerIdAndExchangeNumAndReceiveNumAndUseNum(Long id, Long customerId, long exchangeNum, long receiveNum, long useNum);

    IntegrationCashCouponWallet findByExchangeCodeAndIntegrationChannelIdAndIsDeleteAndExchangeNum(String exchangeCode, long channelId, Whether no, long exchangeNum);

    Long countByExchangeNumAndCashCouponIdAndMallIdAndIsDelete(long exchangeNum, Long cashCouponId, Long mallId, Whether whether);

    IntegrationCashCouponWallet findByIdAndCashCouponId(Long buyIntegrationCashCouponId, Long buyCashId);

    IntegrationCashCouponWallet findTop1ByFaceValueAndIntegrationChannelIdAndIsDeleteAndExchangeNum(BigDecimal faceVal, Long integrationChannelId, Whether whether, long exchangeNum);
}
